/*
 * PFArrayBak.h
 *
 *  Created on: Mar 1, 2014
 *      Author: Anthony Varghese - This is from the Savitch book
 */

#ifndef PFARRAYBAK_H_
#define PFARRAYBAK_H_

#include "PFArray.h"

namespace PFArraySavitch {

template<class T>
class PFArrayBak: public PFArray<T> {
public:
	PFArrayBak(); //Initializes with a capacity of 50.
	PFArrayBak(int capacityValue);
	PFArrayBak(const PFArrayBak<T>& Object);

	void backup();	//Makes a backup copy of the partially filled array.

	/**
	 * Restores the partially filled array to the last saved version.
	 * If backup has never been invoked, this empties the partially filled array.
	 */
	void restore();

	PFArrayBak<T>& operator =(const PFArrayBak<T>& rightSide);

	virtual ~PFArrayBak();
private:
	T *b;      //for a backup of main array.
	int usedB; //backup for inherited member variable used.
};

} /* namespace PFArraySavitch */

#endif /* PFARRAYBAK_H_ */
